package entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author gio
 */
@Entity
@Table(name="University")
@NamedQueries({
//    @NamedQuery(name = "University.findByExchangeProgram", query = "SELECT u FROM University u WHERE u.exchangePrograms =:eprogram")
})
public class University implements Serializable {
    
//    @ManyToMany(mappedBy = "involvedUniversitiesLst")
//    private List<ExchangeProgram> exchangePrograms;
    
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "name", length = 100, nullable = true)
    private String name;

//   @ManyToOne
//    @JoinColumn(name = "city_id", referencedColumnName = "id", nullable = true)
//    private City city;

    @Column(name = "address", length = 200, nullable = true)
    private String address;
    
    @OneToMany(mappedBy="university")
    private List<Users> lstUsers;
    
//    @OneToMany(mappedBy="university")
//    private List<Patent> lstPatent;

    @OneToMany(mappedBy="university")
    private List<Users> lstDevices;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

//    public City getCity() {
//        return city;
//    }
//
//    public void setCity(City city) {
//        this.city = city;
//    }

    public List<Users> getLstUsers() {
        return lstUsers;
    }

    public void setLstUsers(List<Users> lstUsers) {
        this.lstUsers = lstUsers;
    }

//    public List<ExchangeProgram> getExchangePrograms() {
//        return exchangePrograms;
//    }
//
//    public void setExchangePrograms(List<ExchangeProgram> exchangePrograms) {
//        this.exchangePrograms = exchangePrograms;
//    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

//    public List<Patent> getLstPatent() {
//        return lstPatent;
//    }
//
//    public void setLstPatent(List<Patent> lstPatent) {
//        this.lstPatent = lstPatent;
//    }

    public List<Users> getLstDevices() {
        return lstDevices;
    }

    public void setLstDevices(List<Users> lstDevices) {
        this.lstDevices = lstDevices;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof University)) {
            return false;
        }
        University other = (University) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidad.University[ id=" + id + " ]";
    }

}

